﻿(function ($) {
    $.widget("lordjs.negColDemoWidget", {
        // default options
        options: {
            containerId: null,
            title: null,
            yTitle: null,
            categories: [],
            series: []

            // callbacks
        },

        // the constructor
        _create: function () {
            var that = this;
            ZEUS.DEBUG.log('Container Id: ' + that.options.containerId);
            ZEUS.DEBUG.log('Title: ' + that.options.title);
            ZEUS.DEBUG.log('Categories: ' + that.options.categories);
            that.drawChart();
        },

        drawChart: function () {
            var that = this;
            chart = new Highcharts.Chart({
                chart: {
                    renderTo: that.options.containerId,
                    defaultSeriesType: 'column'
                },
                title: {
                    text: that.options.title
                },
                xAxis: {
                    categories: that.options.categories
                },
                yAxis: {
                    min: -400,
                    title: {
                        text: that.options.yTitle
                    }
                },
                tooltip: {
                    formatter: function () {
                        return '' +
                        this.series.name + ': ' + this.y + '';
                    }
                },
                credits: {
                    enabled: false
                },
                series: that.options.series
            });
        }
    });
})(jQuery)
